package me.model;

import me.enums.ItemType;

import org.newdawn.slick.Color;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Polygon;

public class Spear extends AdventureItem {

	private Image image = null;
	private final Color color = Color.orange;
	private final ItemType type = ItemType.SPEAR;
	
	private final float SPEAR[] = {0,10,  5,10,  5,5,   10,5,
								   10,10, 10,0,  15,0,  15,5,
								   10,5,  10,10, 40,10, 40,15,
					 			   10,15, 10,20, 15,20, 15,25,
								   10,25, 10,20, 5,20,  5,15,
								   0,15 };
	
	public Spear(ItemType item, float x, float y, int screencode) {

		setScreencode(screencode);
		setX(x);
		setY(y);
		setColor(color);
		setType(type);
		
		poly = new Polygon(setSpear(x,y));
	}
	
	private float[] setSpear(float x, float y){
		
		float coord[] = SPEAR;
		float aux;
		boolean xy = false;
		
		for(int i=0;i<SPEAR.length;i++){
			
			if(xy == false){
				aux = x;
				xy = true;
			}else{
				aux = y;
				xy = false;
			}
			
			coord[i] = aux + SPEAR[i];
		
		}
		
		return coord;
	}
	
	
	
}